<template>
    <div class="cont">
        <CustomForm @submit="submit" title="新增重量标签" :formList="formList"></CustomForm>
    </div>
</template>

<script setup lang="ts">
import CustomForm from '@/components/customForm/CustomForm.vue';
import { CustomFormItem, CustomFormState } from '@/components/customForm/types';

const formList = reactive<CustomFormItem[]>([
    {label:'标签名称',key:'name',type: 'input',required:true},
    {label: '重量标签',key:'weightLabel',required:true,type:'free',children:[],subItemType:'weightLabel'},
    { value: '提交并保存', key: 'submit', type: 'submit' }
])

const submit = (formState: CustomFormState) => {
    alert('表单结果为' + JSON.stringify(formState))
}
</script>

<style scoped></style>